﻿<%@ 
Page Language="C#" 
AutoEventWireup="true" 
CodeBehind="Default.aspx.cs" 
Inherits="WebQueryRole._Default"  
EnableViewState="false"
EnableEventValidation="false" %>
<%@ Register Assembly="Westwind.Web" Namespace="Westwind.Web.Controls" TagPrefix="ww" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Azure Web Query Engine</title>
    <link href="styles/style.css" rel="Stylesheet" type="text/css" />    
    
    <script type="text/javascript" language="javascript">
        // populate data via backend ASP.NET
        var sql_store = <%=jsonSQLStore%>; 
    </script>    
</head>
<body onload="onLoad()">
    <div class="sql_result" id="divErrors" runat="server" />
    <!-- LEFT CONTENT -->
    <form id="serverForm" method="get" runat="server">
        <div id="content_left" class="content_pane">
            <h3>Saved Queries</h3>
            <asp:ListBox runat="server" id="querySelectList" onchange="clickLoadSqlVar()" style="width: 100%"></asp:ListBox>
        </div>
        <!-- CENTER CONTENT -->
        <div id="content_center" class="content_pane">
            <div>
                <h3>Saved Query 
                <input type="button" class="button" disabled id="inputCopyToSql" value="copy to sql" onclick="clickCopyToSQL(false)" />
                <input type="button" class="button" disabled value="execute saved query" id="inputAltQuery" onclick="clickCopyToSQL(true)" />
                </h3>
                <div id="sqlDiv" class="sql_text" runat="server" />
            </div>
            <div>
                <h3>SQL</h3>
                <textarea class="sql_text" style="width: 96%;" id="sqlTextBox" rows="9" name="mySQLTextbox" runat="server"></textarea>
                <br />
                
                Limit the number of results returned:
                <asp:DropDownList id="limitSelect" runat="server">
                <asp:ListItem Text="10" Value="10" />
                <asp:ListItem Text="100" Value="100" Selected="True" />
                <asp:ListItem Text="1000" Value="1000" />
                <asp:ListItem Text="10000" Value="10000" />
                <asp:ListItem Text="unlimited" Value="0" />                
                </asp:DropDownList>

                <input class="button" type="submit" value="Query!" /> |
                <input class="button" type="button" value="Download as tab delimited File" onclick="clickSaveToCSV()" /> | 
                <input class="button" type="button" value="Save as Table" onclick="clickSaveToView()" />
            </div>
            <div>
                <h3>Title</h3>
                <input class="desc_text" type="text" style="width: 75%" maxlength="50" runat="server" id="create_query_short_desc_input" />
                <input class="button" type="button" value="save" onclick="clickSaveSqlVar()" /> | 
                <input class="button" type="button" value="delete" onclick="clickDeleteSqlVar()" />
            </div>
            <div>
                <h3>Description</h3>
                <textarea class="desc_text" style="width: 96%" rows="6" runat="server" id="create_query_long_desc_input"></textarea>
            </div>
        </div>            
        </form>
    
    <!-- BOTTOM CONTENT (sql output, errors) -->
    <div id="content_bottom">
        <div class="sql_result" id="divSqlRowsFound" runat="server" />
        <asp:PlaceHolder ID="myPlaceHolder" runat="server" />            
    </div>
    
    
    <!-- INITIALIZE SCRIPTS // NOT PART OF GUI -->
    <ww:AjaxMethodCallback ID="Proxy" runat="server" Timeout="4000" />
    <ww:ScriptContainer runat="server" ID="Scripts">
        <Scripts>            
            <script src="~/scripts/jquery.js" Resource="jquery"></script>
            <script src="~/scripts/ww.jQuery.js" Resource="ww.jquery"></script>
            <script src="scripts/ajaxcallbacks.js"></script>
        </Scripts>
    </ww:ScriptContainer>
</body>
</html>
